package com.budwk.app.sqfwV2.generator.centuryCity;

import cn.hutool.core.date.DateUtil;
import com.budwk.app.sqfwDoc.codeGenerator.pdfGenerate.BaseTemplatePdfGenerator;
import com.budwk.app.sqfwDoc.codeGenerator.pdfGenerate.SqfwPdfCreateCommonBO;
import com.budwk.app.sqfwV2.dto.dto.OldCareServiceStationPdfDTO;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * 本代码由代码生成器生成，版本号1.0
 */
public class CenturyCityOldCareServicePatrolPdfGenerator extends BaseTemplatePdfGenerator {

    /**
     * 判断使用使用这个generator生成pdf
     *
     * @param pdfDTO 创建pdf数据素材
     * @return 结果
     */
    @Override
    public boolean pdfCreateConditionCheck(SqfwPdfCreateCommonBO pdfDTO) {
        return true;
    }

    @Override
    public String getTemplateName() {
        return "jinYuanCenturyCity/oldCareServicePatrol.docx";
    }


    @Override
    public void customerPopularPdfParam(Map<String, Object> paramMap, SqfwPdfCreateCommonBO pdfParamBO) {
        // 针对特殊字段进行数据填充 进行复杂的业务逻辑
        OldCareServiceStationPdfDTO pdfFieldDTO = (OldCareServiceStationPdfDTO) pdfParamBO.getAbstractCustomerPdfCreateField();
        String businessSituation = pdfFieldDTO.getBusinessSituation();
        if (StringUtils.isBlank(businessSituation)) businessSituation = "";

        paramMap.put("businessSituation", businessSituation);

        paramMap.put("fillDateStr", DateUtil.format(pdfParamBO.getBasePdfParamDTO().getFillDate(), "yyyy-MM-dd"));
    }
}
